Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support looser type checking when constraining profile types #1311

Closed
wants to merge 2 commits into from

Conversation

cmoesel
Copy link
Member

@cmoesel cmoesel commented Jul 24, 2023

When constraining an element's type, the previous behavior required the new type to be a formal child of the old type. If the old type is a profile, however, the new type shouldn't have to be a formal subtype; it need only conform to the old type. When this occurs, log a warning but let it proceed.

You can test this using Julia's FSH Online example. On master branch, it will cause an error and not allow the constraint. On this branch it will log a warning but allow the constraint.

But... Oh no! I just tested this w/ IG Publisher and the IG Publisher gives this error:

Unable to generate snapshot for http://example.org/StructureDefinition/SimpleExampleObservation in /Users/cmoesel/data/fsh/LooserTypeConstraints/fsh-generated/resources/StructureDefinition-SimpleExampleObservation because StructureDefinition http://example.org/StructureDefinition/SimpleExampleObservation at Observation.performer: invalid constrained type Reference from Reference in http://example.org/StructureDefinition/SimpleExampleObservation

It seems that maybe the IG Publisher requires formal inheritance even though that might not be strictly necessary. Putting this into DRAFT mode until we resolve this with the IG Publisher team.

Fixes #1289 and CIMPL-1122.

When constraining an element's type, the previous behavior required the new type to be a formal child of the old type. If the old type is a profile, however, the new type shouldn't have to be a formal subtype; it need only conform to the old type. When this occurs, log a warning but let it proceed.
@cmoesel
Copy link
Member Author

cmoesel commented Aug 24, 2023

Closing this PR, as the IG Publisher does not support looser type checking -- so even if SUSHI supports it, authors will just get errors further down the line.

@cmoesel cmoesel closed this Aug 24, 2023
@cmoesel cmoesel reopened this Sep 5, 2023
@cmoesel
Copy link
Member Author

cmoesel commented Sep 5, 2023

Re-opening this PR as draft since Grahame has specified an approach to indicating when a profile conforms to another even if it is not in its direct hierarchy. See this thread: https://chat.fhir.org/#narrow/stream/215610-shorthand/topic/Question.20about.20inheriting.20profiles/near/389046996

This PR will need to be updated to consider the structuredefinition-imposeProfile extension.

@cmoesel
Copy link
Member Author

cmoesel commented Oct 4, 2023

This PR is now obsolete and replaced by #1366.

@cmoesel cmoesel closed this Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider issuing a warning (instead of an error) when constraining a type that is not a formal subtype
1 participant